package com.sky.mapper;

import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * 目标:
 *
 * @author YUE
 * @date 2024/6/12 11:07
 */
@Mapper
public interface SetmealDishMapper {

    List<Long> getSetmealIdsByDishIds(List<Long> ids);

    /*
      添加套餐菜品
     */
    void insterBatch(List<SetmealDish> setmealDishes);


    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deletesetmealDish(Long id);

    /*
      根据id查询菜品
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getByIdDish(Long id);

    // 根据菜品id 查询套餐
    @Select("select setmeal.* from setmeal left join setmeal_dish on setmeal.id = setmeal_dish.setmeal_id where dish_id = #{dishId}")
//    @Select("select s.*  from setmeal_dish s where dish_id = #{diahId}")
    List<Setmeal> getDishIdBySermeal(Long id);

}
